package com.weixin.paleituo.adapter;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;

import com.bumptech.glide.Glide;
import com.weixin.paleituo.R;
import com.weixin.paleituo.activity.CheckstandActivity;
import com.weixin.paleituo.activity.ExpressActivity;
import com.weixin.paleituo.activity.GoodsStoreActivity;
import com.weixin.paleituo.activity.InvoiceDetailActivity;
import com.weixin.paleituo.activity.OrderDetailsActivity;
import com.weixin.paleituo.annotation.OrderStatusType;
import com.weixin.paleituo.base.BaseOrderRecycleAdapter;
import com.weixin.paleituo.bean.GoodsListBean;
import com.weixin.paleituo.bean.OrderCreatedBean;
import com.weixin.paleituo.bean.StoreListBean;
import com.weixin.paleituo.contans.Contans;
import com.weixin.paleituo.eventbus.AllOrderEvent;
import com.weixin.paleituo.util.LogUtils;
import com.weixin.paleituo.util.StringUtils;
import com.weixin.paleituo.util.UIUtils;
import com.weixin.paleituo.view.MyHorizontalScrollView;
import com.weixin.paleituo.view.TipsDialog;

import org.greenrobot.eventbus.EventBus;

import java.util.ArrayList;
import java.util.List;

/**
 * Author yichao
 * Time  2018/4/7 17:51
 * Dest  取消订单
 */

public class AllOrderRecycleAdapter extends BaseOrderRecycleAdapter {


    public AllOrderRecycleAdapter(Context context, List<StoreListBean> storeListBeans) {
        super(context, storeListBeans);
    }
    @Override
    protected void setNoCustomCancleData(NoCustomCancleViewHolder noCustomCancleViewHolder, final StoreListBean storeListBean, List<GoodsListBean> goodsList, final int position) {
        String storeName = storeListBean.getStoreName();
        if (!StringUtils.isEmpty(storeName) && storeName.equals("舒社")) {
            noCustomCancleViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.shushe_logo);
            noCustomCancleViewHolder.mTvStoreNameItemOrderHead.setText("舒社");
            noCustomCancleViewHolder.mIvMoreItemOrderHead.setVisibility(View.INVISIBLE);
        } else {
            noCustomCancleViewHolder.mIvMoreItemOrderHead.setVisibility(View.VISIBLE);
            noCustomCancleViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.store_cart);
            noCustomCancleViewHolder.mTvStoreNameItemOrderHead.setText(storeListBean.getStoreName());
            noCustomCancleViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
                }
            });
        }
        HorizontalScrollViewGoodsItemAdapter horizontalScrollViewGoodsItemAdapter=new HorizontalScrollViewGoodsItemAdapter(mContext, (ArrayList<GoodsListBean>) goodsList);

        noCustomCancleViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.initDatas(horizontalScrollViewGoodsItemAdapter);

        noCustomCancleViewHolder.mTvGoodsnumberCustomForPricing.setText("共" + storeListBean.getNum() + "件商品  ");
        noCustomCancleViewHolder.mTvAwaitpayforCustomForPricing.setText("￥" + UIUtils.getMoney( storeListBean.getActualPrice()));
        noCustomCancleViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.setOnItemClickListener(new MyHorizontalScrollView.OnItemClickListener() {
            @Override
            public void onClick(View view, int pos) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),null);
                mContext.startActivity(intent);
            }
        });

        noCustomCancleViewHolder.mIvDelItemCancelOrderHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              //  ToastUtils.makeText("删除");
                showGotGoodsDialog(position,"确定删除订单","取消","确定",Contans.DELETE_ORDER_TYPE);

            }
        });

        noCustomCancleViewHolder.mLlNocustomRightLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),null);
                mContext.startActivity(intent);
            }
        });
    }
    @Override
    protected void setCustomCancleData(CustomCancleViewHolder customCancleViewHolder, final StoreListBean storeListBean, List<GoodsListBean> goodsList, final int position) {
        String storeName = storeListBean.getStoreName();
        if (!StringUtils.isEmpty(storeName) && storeName.equals("舒社")) {
            customCancleViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.shushe_logo);
            customCancleViewHolder.mTvStoreNameItemOrderHead.setText("舒社");
            customCancleViewHolder.mIvMoreItemOrderHead.setVisibility(View.INVISIBLE);
        } else {
            customCancleViewHolder.mIvMoreItemOrderHead.setVisibility(View.VISIBLE);
            customCancleViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.store_cart);
            customCancleViewHolder.mTvStoreNameItemOrderHead.setText(storeListBean.getStoreName());
            customCancleViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
                }
            });
        }

        Glide.with(mContext).load(goodsList.get(0).getListUrl()).into(customCancleViewHolder.mIvGoodsiconCustomForPricing);
        customCancleViewHolder.mTvMessgeCustomForPricing.setText(storeListBean.getMsg() + "");
        customCancleViewHolder.mTvGoodsnumberCustomForPricing.setText("共" + storeListBean.getNum() + "件商品  ");
        customCancleViewHolder.mTvAwaitpayforCustomForPricing.setText("￥" + storeListBean.getActualPrice());

        customCancleViewHolder.mLlCustomconetRootLayoutOrderCustomConttent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),  null);
                mContext.startActivity(intent);
            }
        });
        customCancleViewHolder.mIvDelItemCancelOrderHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {



                showGotGoodsDialog(position,"确定删除订单","取消","确定",Contans.DELETE_ORDER_TYPE);
            }
        });

    }

    @Override
    protected void setNoCustomAwaitPayforData(NoCustomAwaitPayforViewHolder noCustomAwaitPayforViewHolder
            , final StoreListBean storeListBean
            , List<GoodsListBean> goodsList, int position) {
        String storeName = storeListBean.getStoreName();
        if (!StringUtils.isEmpty(storeName) && storeName.equals("舒社")) {
            noCustomAwaitPayforViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.shushe_logo);
            noCustomAwaitPayforViewHolder.mTvStoreNameItemOrderHead.setText("舒社");
            noCustomAwaitPayforViewHolder.mIvMoreItemOrderHead.setVisibility(View.INVISIBLE);
        } else {
            noCustomAwaitPayforViewHolder.mIvMoreItemOrderHead.setVisibility(View.VISIBLE);
            noCustomAwaitPayforViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.store_cart);
            noCustomAwaitPayforViewHolder.mTvStoreNameItemOrderHead.setText(storeListBean.getStoreName());
            noCustomAwaitPayforViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
                }
            });
        }
        HorizontalScrollViewGoodsItemAdapter horizontalScrollViewGoodsItemAdapter=new HorizontalScrollViewGoodsItemAdapter(mContext, (ArrayList<GoodsListBean>) goodsList);

        noCustomAwaitPayforViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.initDatas(horizontalScrollViewGoodsItemAdapter);
        noCustomAwaitPayforViewHolder.mTvPricestateItemOrderHead.setText("等待付款");
        noCustomAwaitPayforViewHolder.mTvGoodsnumberItemNocustomAwaitfor.setText("共" + storeListBean.getNum() + "件商品  需付款:");
        noCustomAwaitPayforViewHolder.mTvPaymoneyItemNocustomAwaitfor.setText("￥" + UIUtils.getMoney( storeListBean.getActualPrice()));
        noCustomAwaitPayforViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.setOnItemClickListener(new MyHorizontalScrollView.OnItemClickListener() {
            @Override
            public void onClick(View view, int pos) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(), null);
                mContext.startActivity(intent);
            }
        });

        noCustomAwaitPayforViewHolder.mTvGopayforItemNocustom.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                OrderCreatedBean orderCreatedBean=new OrderCreatedBean();
                orderCreatedBean.setOrderId(storeListBean.getId());
                orderCreatedBean.setActualPrice(storeListBean.getActualPrice());
                Intent intent = CheckstandActivity.call2CheckstandActivity(mContext, 1, orderCreatedBean);
                mContext.startActivity(intent);
            }
        });
        noCustomAwaitPayforViewHolder.mLlNocustomRightLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),null);
                mContext.startActivity(intent);
            }
        });

    }
    @Override
    protected void setCustomAwaitPayforcData(CustomAwaitPayforViewHolder customAwaitPayforViewHolder, final StoreListBean storeListBean, List<GoodsListBean> goodsList, int position) {
        customAwaitPayforViewHolder.mTvStoreNameItemOrderHead.setText(storeListBean.getStoreName() + "");
        customAwaitPayforViewHolder.mTvPricestateItemOrderHead.setText("等待付款");
        Glide.with(mContext).load(goodsList.get(0).getListUrl()).into(customAwaitPayforViewHolder.mIvGoodsiconCustomForPricing);
        customAwaitPayforViewHolder.mTvMessgeCustomForPricing.setText(storeListBean.getMsg() + "");
        customAwaitPayforViewHolder.mTvGoodsnumberItemCustomAwaitfor.setText("共" + storeListBean.getNum() + "件商品  需付款:");
        customAwaitPayforViewHolder.mTvPayforMoneyItemCustomAwaitfor.setText("￥" + UIUtils.getMoney(storeListBean.getGoodsPrice()));
        customAwaitPayforViewHolder.mTvGopayforItemCustomAwaitfor.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                OrderCreatedBean orderCreatedBean=new OrderCreatedBean();
                orderCreatedBean.setOrderId(storeListBean.getId());
                orderCreatedBean.setActualPrice(storeListBean.getGoodsPrice());
                orderCreatedBean.setCouponMoney(storeListBean.getCuCouponMoney());
                Intent intent = CheckstandActivity.call2CheckstandActivity(mContext, 0, orderCreatedBean);
                mContext.startActivity(intent);
            }
        });
        customAwaitPayforViewHolder.mLlCustomconetRootLayoutOrderCustomConttent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),  "");
                mContext.startActivity(intent);
            }
        });
        customAwaitPayforViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
            }
        });
    }
    @Override
    protected void setCustomAwaitPricData(CustomAwaitPriceViewHolder customAwaitPriceViewHolder,
                                          final StoreListBean storeListBean, List<GoodsListBean> goodsList, int position) {
        customAwaitPriceViewHolder.mTvStoreNameItemOrderHead.setText(storeListBean.getStoreName() + "");
        customAwaitPriceViewHolder.mTvPricestateItemOrderHead.setText("等待定价");
        Glide.with(mContext).load(goodsList.get(0).getListUrl()).into(customAwaitPriceViewHolder.mIvGoodsiconCustomForPricing);
        customAwaitPriceViewHolder.mTvMessgeCustomForPricing.setText(storeListBean.getMsg() + "");
        customAwaitPriceViewHolder.mTvGoodsnumberCustomForPricing.setText("共" + storeListBean.getNum() + "件商品  需付款:");
        customAwaitPriceViewHolder.mTvAwaitpayforCustomForPricing.setText("￥待定");
        customAwaitPriceViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
            }
        });

        customAwaitPriceViewHolder.mLlCustomconetRootLayoutOrderCustomConttent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),"");
                mContext.startActivity(intent);

            }
        });

        customAwaitPriceViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
            }
        });

    }

    @Override
    protected void setNoCustomAwaitReceingData(NoCustomAwaitReceingViewHolder noCustomAwaitReceingViewHolder, final StoreListBean storeListBean, List<GoodsListBean> goodsList, final int position) {

        String storeName = storeListBean.getStoreName();
        if (!StringUtils.isEmpty(storeName) && storeName.equals("舒社")) {
            noCustomAwaitReceingViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.shushe_logo);
            noCustomAwaitReceingViewHolder.mTvStoreNameItemOrderHead.setText("舒社");
            noCustomAwaitReceingViewHolder.mIvMoreItemOrderHead.setVisibility(View.INVISIBLE);
        } else {
            noCustomAwaitReceingViewHolder.mIvMoreItemOrderHead.setVisibility(View.VISIBLE);
            noCustomAwaitReceingViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.store_cart);
            noCustomAwaitReceingViewHolder.mTvStoreNameItemOrderHead.setText(storeListBean.getStoreName());
            noCustomAwaitReceingViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
                }
            });
        }
        String acceptStation = storeListBean.getAcceptStation();
        String acceptTime = storeListBean.getAcceptTime();
        String orderDetailId = storeListBean.getOrderDetailId();

        if (!StringUtils.isEmpty(acceptStation)&&!StringUtils.isEmpty(acceptTime)&&!StringUtils.isEmpty(orderDetailId)) {
            noCustomAwaitReceingViewHolder.mRlExpressinfoNocustomAwaitReceving.setVisibility(View.VISIBLE);
            noCustomAwaitReceingViewHolder.mTvCheckExpressCustomAwaitReceving.setVisibility(View.VISIBLE);
        }else {
            noCustomAwaitReceingViewHolder.mRlExpressinfoNocustomAwaitReceving.setVisibility(View.GONE);
            noCustomAwaitReceingViewHolder.mTvCheckExpressCustomAwaitReceving.setVisibility(View.INVISIBLE);
        }
        if (storeListBean.getOrderStatus()== OrderStatusType.WAIT_RECEIVING){
            noCustomAwaitReceingViewHolder.mTvPricestateItemOrderHead.setText("等待发货");
            noCustomAwaitReceingViewHolder.mRlNocustomAwaitReceving.setVisibility(View.GONE);


        }else {
            noCustomAwaitReceingViewHolder.mTvPricestateItemOrderHead.setText("等待收货");
            noCustomAwaitReceingViewHolder.mRlNocustomAwaitReceving.setVisibility(View.VISIBLE);
        }
        noCustomAwaitReceingViewHolder.mTvExpresstitleNocustomAwaitReceving.setText(""+acceptStation);
        noCustomAwaitReceingViewHolder.mTvExpressTimeNocustomAwaitReceving.setText(""+acceptTime);

        HorizontalScrollViewGoodsItemAdapter horizontalScrollViewGoodsItemAdapter=new HorizontalScrollViewGoodsItemAdapter(mContext, (ArrayList<GoodsListBean>) goodsList);

        noCustomAwaitReceingViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.initDatas(horizontalScrollViewGoodsItemAdapter);

        noCustomAwaitReceingViewHolder.mTvGoodsnumberNocustomAwaitReceving.setText("共" + storeListBean.getNum() + "件商品  实付款:");
        noCustomAwaitReceingViewHolder.mTvAwaitpayforNocustomAwaitReceving.setText("￥" + UIUtils.getMoney( storeListBean.getActualPrice()));
        noCustomAwaitReceingViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.setOnItemClickListener(new MyHorizontalScrollView.OnItemClickListener() {
            @Override
            public void onClick(View view, int pos) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(), storeListBean.getDetailId() + "");
                mContext.startActivity(intent);
            }
        });

        noCustomAwaitReceingViewHolder.mTvCheckExpressCustomAwaitReceving.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //查看物流
                LogUtils.i(TAG,"查看物流");

                ExpressActivity.startActivity(mContext,storeListBean.getOrderDetailId());
            }
        });

        /**确定收货*/
        noCustomAwaitReceingViewHolder.mTvSurerecevingNocustomAwaitReceving.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //
                // ToastUtils.makeText("确定收货");
                LogUtils.i(TAG,"确定收货");

                showGotGoodsDialog(position,"您是否已收到该订单商品？","未收货","已收货", Contans.SURE_ACCEPT_GOODS_TYPE);
            }
        });
        noCustomAwaitReceingViewHolder.mLlNocustomRightLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),null);
                mContext.startActivity(intent);
            }
        });
    }
    TipsDialog mGotGoodsDialog;

    /**
     * 弹窗
     * @param position
     * @param content
     * @param left
     * @param right
     */
    private void showGotGoodsDialog(final int position, final String content, String left , String right, final int type) {

        mGotGoodsDialog = new TipsDialog.Builder(mContext)
                .setCancelClickListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        mGotGoodsDialog.dismiss();
                    }
                })
                .setContentView(content)
                .setLeftButton(left, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mGotGoodsDialog.dismiss();
                    }
                })
                .setRightButton(right, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mGotGoodsDialog.dismiss();

                        EventBus.getDefault().post(new AllOrderEvent(position,type));
                    }
                })
                .build();

        mGotGoodsDialog.show();
    }

    @Override
    protected void setCustomAwaitReceingData(CustomAwaitReceingViewHolder customAwaitReceingViewHolder, final StoreListBean storeListBean, List<GoodsListBean> goodsList, final int position) {
        String storeName = storeListBean.getStoreName();
        if (!StringUtils.isEmpty(storeName) && storeName.equals("舒社")) {
            customAwaitReceingViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.shushe_logo);
            customAwaitReceingViewHolder.mTvStoreNameItemOrderHead.setText("舒社");
            customAwaitReceingViewHolder.mIvMoreItemOrderHead.setVisibility(View.INVISIBLE);
        } else {
            customAwaitReceingViewHolder.mIvMoreItemOrderHead.setVisibility(View.VISIBLE);
            customAwaitReceingViewHolder.mIvIconItemOrderHead.setImageResource(R.mipmap.store_cart);
            customAwaitReceingViewHolder.mTvStoreNameItemOrderHead.setText(storeListBean.getStoreName());
            customAwaitReceingViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
                }
            });
        }
        String acceptStation = storeListBean.getAcceptStation();
        String acceptTime = storeListBean.getAcceptTime();
        String orderDetailId = storeListBean.getOrderDetailId();

        if (!StringUtils.isEmpty(acceptStation)&&!StringUtils.isEmpty(acceptTime)&&!StringUtils.isEmpty(orderDetailId)) {
            customAwaitReceingViewHolder.mRlExpressinfoCustomAwaitReceving.setVisibility(View.VISIBLE);
            customAwaitReceingViewHolder.mTvCheckExpressCustomAwaitReceving.setVisibility(View.VISIBLE);
        }else {
            customAwaitReceingViewHolder.mTvCheckExpressCustomAwaitReceving.setVisibility(View.INVISIBLE);
            customAwaitReceingViewHolder.mRlExpressinfoCustomAwaitReceving.setVisibility(View.GONE);
        }
        if (storeListBean.getOrderStatus()== OrderStatusType.WAIT_RECEIVING){
            customAwaitReceingViewHolder.mTvPricestateItemOrderHead.setText("等待发货");

            customAwaitReceingViewHolder.mRlFootCustomAwaitReceving.setVisibility(View.GONE);

        }else {
            customAwaitReceingViewHolder.mTvPricestateItemOrderHead.setText("等待收货");;
            customAwaitReceingViewHolder.mRlFootCustomAwaitReceving.setVisibility(View.VISIBLE);
        }
        customAwaitReceingViewHolder.mTvExpresstitleCustomAwaitReceving.setText(""+acceptStation);
        customAwaitReceingViewHolder.mTvExpressTimeCustomAwaitReceving.setText(""+acceptTime);


        Glide.with(mContext).load(goodsList.get(0).getListUrl()).into(customAwaitReceingViewHolder.mIvGoodsiconCustomForPricing);
        customAwaitReceingViewHolder.mTvMessgeCustomForPricing.setText(storeListBean.getMsg() + "");
        customAwaitReceingViewHolder.mTvGoodsnumberCustomAwaitReceving.setText("共" + storeListBean.getNum() + "件商品  实付款:");
        customAwaitReceingViewHolder.mTvAwaitpayforCustomAwaitReceving.setText("￥"+ UIUtils.getMoney( storeListBean.getActualPrice()));
        customAwaitReceingViewHolder.mLlStorerootItemOrderHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
            }
        });


        customAwaitReceingViewHolder.mLlCustomconetRootLayoutOrderCustomConttent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(), storeListBean.getDetailId() + "");
                mContext.startActivity(intent);

            }
        });

        /**确定收货*/
        customAwaitReceingViewHolder.mTvSurerecevingCustomAwaitReceving.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //
                //  ToastUtils.makeText("确定收货");
                LogUtils.i(TAG,"确定收货");

                showGotGoodsDialog(position,"您是否已收到该订单商品","未收货","已收货",Contans.SURE_ACCEPT_GOODS_TYPE);

            }
        });
        customAwaitReceingViewHolder.mTvCheckExpressCustomAwaitReceving.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //查看物流
                //  ToastUtils.makeText("查看物流");
                LogUtils.i(TAG,"查看物流");
                ExpressActivity.startActivity(mContext,storeListBean.getOrderDetailId());
            }
        });

    }

    @Override
    protected void setNoCustomCompleteData(NoCustomCompleteViewHolder noCustomCompleteViewHolder, final StoreListBean storeListBean, List<GoodsListBean> goodsList, final int position) {
        String storeName = storeListBean.getStoreName();
        if (!StringUtils.isEmpty(storeName) && storeName.equals("舒社")) {
            noCustomCompleteViewHolder.mIvIconItemOrderCompleteHead.setImageResource(R.mipmap.shushe_logo);
            noCustomCompleteViewHolder.mTvStoreNameItemOrderCompleteHead.setText("舒社");
            noCustomCompleteViewHolder.mIvMoreItemOrderHead.setVisibility(View.INVISIBLE);
        } else {
            noCustomCompleteViewHolder.mIvMoreItemOrderHead.setVisibility(View.VISIBLE);
            noCustomCompleteViewHolder.mIvIconItemOrderCompleteHead.setImageResource(R.mipmap.store_cart);
            noCustomCompleteViewHolder.mTvStoreNameItemOrderCompleteHead.setText(storeListBean.getStoreName());
            noCustomCompleteViewHolder.mLlStorerootItemOrderCompleteHead.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
                }
            });
        }

        HorizontalScrollViewGoodsItemAdapter horizontalScrollViewGoodsItemAdapter=new HorizontalScrollViewGoodsItemAdapter(mContext, (ArrayList<GoodsListBean>) goodsList);

        noCustomCompleteViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.initDatas(horizontalScrollViewGoodsItemAdapter);

        noCustomCompleteViewHolder.mTvGoodsnumberNocustomComplete.setText("共" + storeListBean.getNum() + "件商品  ");
        noCustomCompleteViewHolder.mTvAwaitpayforNocustomComplete.setText("￥" + UIUtils.getMoney( storeListBean.getActualPrice()));
        noCustomCompleteViewHolder.mIdHorizontalScrollViewItemNocustomAwaitfor.setOnItemClickListener(new MyHorizontalScrollView.OnItemClickListener() {
            @Override
            public void onClick(View view, int pos) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(), storeListBean.getDetailId() + "");
                mContext.startActivity(intent);
            }
        });
        noCustomCompleteViewHolder.mTvSurerecevingNoccustomComplete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mContext.startActivity(InvoiceDetailActivity.call2InvoiceDetailActivity(mContext, storeListBean.getId()));
            }
        });
        noCustomCompleteViewHolder.mIvDeleteItemOrderCompleteHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              //  ToastUtils.makeText("删除");
                showGotGoodsDialog(position,"确定删除订单","取消","确定",Contans.DELETE_ORDER_TYPE);
            }
        });
        noCustomCompleteViewHolder.mLlNocustomRightLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(),null);
                mContext.startActivity(intent);
            }
        });
    }

    @Override
    protected void setCustomCompleteData(CustomCompleteViewHolder customCompleteViewHolder, final StoreListBean storeListBean, List<GoodsListBean> goodsList, final int position) {
        String storeName = storeListBean.getStoreName();
        if (!StringUtils.isEmpty(storeName) && storeName.equals("舒社")) {
            customCompleteViewHolder.mIvIconItemOrderCompleteHead.setImageResource(R.mipmap.shushe_logo);
            customCompleteViewHolder.mTvStoreNameItemOrderCompleteHead.setText("舒社");
            customCompleteViewHolder.mIvMoreItemOrderHead.setVisibility(View.INVISIBLE);
        } else {
            customCompleteViewHolder.mIvMoreItemOrderHead.setVisibility(View.VISIBLE);
            customCompleteViewHolder.mIvIconItemOrderCompleteHead.setImageResource(R.mipmap.store_cart);
            customCompleteViewHolder.mTvStoreNameItemOrderCompleteHead.setText(storeListBean.getStoreName());
            customCompleteViewHolder.mLlStorerootItemOrderCompleteHead.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    GoodsStoreActivity.startActivity(mContext,storeListBean.getStoreId());
                }
            });
        }
        Glide.with(mContext).load(goodsList.get(0).getListUrl()).into(customCompleteViewHolder.mIvGoodsiconCustomForPricing);
        customCompleteViewHolder.mTvMessgeCustomForPricing.setText(storeListBean.getMsg() + "");
        customCompleteViewHolder.mTvGoodsnumberCustomComplete.setText("共" + storeListBean.getNum() + "件商品  ");
        customCompleteViewHolder.mTvAwaitpayforCustomComplete.setText("￥" + storeListBean.getActualPrice());
        customCompleteViewHolder.mTvSurerecevingCcustomComplete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //
                mContext.startActivity(InvoiceDetailActivity.call2InvoiceDetailActivity(mContext, storeListBean.getId()));
            }
        });
        customCompleteViewHolder.mLlCustomconetRootLayoutOrderCustomConttent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = OrderDetailsActivity.call2OrderDetailsActivity(mContext, storeListBean.getId(), storeListBean.getDetailId() + "");
                mContext.startActivity(intent);
            }
        });

        customCompleteViewHolder.mIvDeleteItemOrderCompleteHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                showGotGoodsDialog(position,"确定删除订单","取消","确定",Contans.DELETE_ORDER_TYPE);
            }
        });


    }


}
